what is this error? failed to get logs: Agent is s...
# ask-ai
b
what is this error? failed to get logs: Agent is sleeping due to inactivity - create a new session to wake it up and view logs
t
Thanks for reaching out, Samuel. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
I understand that seeing the message "Agent is sleeping due to inactivity" might be a bit confusing. This simply means the agent has been scaled down to zero active instances after a period of inactivity, which is actually a normal and helpful behavior in certain LiveKit plans to manage resources efficiently. To get things going again, you can create a new session—this will automatically wake the agent and let you view the logs. If the agent doesn’t wake up as expected, here are a few steps you can try: • Check the agent's deployment status using
lk agent status
. • Stream deployment logs with
lk agent logs --id <agent-id> --log-type deploy
to spot any issues. • Redeploy the agent using
lk agent deploy
or restart it with
lk agent restart --id <agent-id>
. If you run into any trouble or need a hand with these steps, please don’t hesitate to reach out—I’m here to help! Sources: Events and error handling | LiveKit Docs | Agent deployment CLI reference | LiveKit Docs | Docs::Agents | Agent deployment CLI reference | LiveKit Docs | livekit-plugins/livekit-plugins-elevenlabs/livekit/plugins/elevenlabs/tts.p...
b
am on a free trial account. deployed LiveKit cloud, it did work but after sometime, it didnt accept any of the call cuz it went to sleep mode and even after lk agent restart.. no call responding and it shows "failed to get logs: Agent is sleeping due to inactivity - create a new session to wake it up and view logs". give me solid fix for it.. for your information agent is running start mode.
t
Thank you for reaching out! On free trial accounts, it’s completely normal for agents to enter a "Sleeping" state after some inactivity. When a new call comes in, the agent should naturally move to "Waking" and pick up right where it left off. If you notice the agent isn’t responding even after a restart, don’t worry—we can work through this together. Here are a few steps you can try: • First, run
lk agent status
to check what state the agent is currently in. If it says "Sleeping," it should wake up once a new session starts. • If it’s still not waking up, take a look at the deployment logs by running
lk agent logs --id <agent-id> --log-type deploy
. This can help us spot any underlying issues. • Also, double-check that your free trial account is active and hasn’t been suspended—you can confirm this in your LiveKit dashboard. • If none of these work, try redeploying the agent with
lk agent deploy
. Sometimes a fresh start does the trick! Please feel free to reach out if you run into any specific errors or need a hand with these steps. I’m here to help! Sources: Deploying to production | LiveKit Docs | Agent deployment CLI reference | LiveKit Docs
b
When i run this lk agent logs --id CA_dWWqY6sTnvdU --log-type deploy, got this response: failed to get logs: Agent is sleeping due to inactivity - create a new session to wake it up and view logs
t
I understand how the error "failed to get logs: Agent is sleeping due to inactivity" can be a bit confusing. This happens because the agent is in a "Sleeping" state, which is completely normal for free trial accounts after some inactivity. Here’s a simple way to get things back on track: 1. Wake up the agent by creating a new session. You can do this easily through the Agent Playground, a custom frontend, or telephony integration. 2. Next, check the agent's status with
lk agent status --id CA_dWWqY6sTnvdU
. You’ll want to see it switch to "Running." 3. Once it’s active, you can stream the runtime logs using
lk agent logs --id CA_dWWqY6sTnvdU
. 4. If you need to access logs while the agent is still sleeping, try
lk agent logs --id CA_dWWqY6sTnvdU --log-type=build
to view the build-time logs. Please don’t hesitate to reach out if you run into any bumps along the way or if there’s anything else I can help with. I’m here for you! Sources: Agent deployment CLI reference | LiveKit Docs | Agent deployment CLI reference | LiveKit Docs | Docs::Agents | Docs::Agents | Docs::Agents
b
will this work? Remove request_fnc for True Automatic Dispatch ⭐ Best Fix │ │ │ │ │ │ │ │ Why: │ │ │ │ - request_fnc prevents automatic acceptance │ │ │ │ - Sleeping agents can't run request_fnc │ │ │ │ - Removing it enables LiveKit to automatically dispatch jobs │ │ │ │ │ │ │ │ Change: │ │ │ │ # REMOVE request_fnc entirely │ │ │ │ WorkerOptions( │ │ │ │ entrypoint_fnc=entrypoint, │ │ │ │ # request_fnc=request_fnc, # ← REMOVE THIS │ │ │ │ ) │ │ │ │ │ │ │ │ Expected Result: │ │ │ │ - LiveKit handles job acceptance automatically │ │ │ │ - Agent wakes up and joins room immediately │ │ │ │ - No manual intervention needed
t
Thank you for reaching out! I’d love to help clarify things about removing
request_fnc
from
WorkerOptions
. While it might seem like this change could enable automatic dispatch or resolve sleeping agent issues, here’s a friendly breakdown of what’s actually happening: • Automatic Dispatch: This is managed by the
agent_name
field. If
agent_name
isn’t set, automatic dispatch is turned on. But if it is set, only explicit dispatch will work. • Job Acceptance: Taking out
request_fnc
changes how jobs get accepted after dispatch. Without it, jobs get accepted automatically by default. • Agent Availability: The idea of a "sleeping agent" isn’t something LiveKit defines. Instead, an agent’s availability depends on its connection and load, not whether
request_fnc
is present. If your agent isn’t picking up jobs, here are a few things you might want to check: 1. Is
agent_name
set in your
WorkerOptions
? 2. What’s the agent’s connection and load status? You can check this using
lk agent status
. 3. Are there any issues with room creation or token configuration? Please don’t hesitate to reach out if you’d like me to help you dig deeper into this. I’m here to support you every step of the way! Sources: Agent dispatch | LiveKit Docs | Agents telephony integration | LiveKit Docs | livekit-agents/livekit/agents/worker.py | Anatomy of an Agent | LiveKit Docs | Worker options | LiveKit Docs
b
if large dependencies can cause cold start failures in LiveKit Cloud agents
t
Thanks for reaching out! The knowledge base doesn’t specifically say if large dependencies cause cold start failures in LiveKit Cloud agents. Could you share if you’ve noticed any particular errors or delays when your agent starts up? If you can tell me a bit about your agent setup or the size of your dependencies, it would really help us figure out what might be going on together. Sources: Deploying to production | LiveKit Docs
b
need to resolve this egress. 1. ✅ Recording starts successfully (Egress ID: EG_n3RAjjfogxhV) 2. ❌ Error when stopping: 'str' object has no attribute 'SerializeToString'
t
It looks like the error "'str' object has no attribute 'SerializeToString'" happens when a string is passed directly to the
StopEgress
method instead of a properly constructed
StopEgressRequest
protobuf message object. To help you fix this, please make sure you're using the correct request format. Here’s a friendly example in Python:
Copy code
from livekit.protocol.egress import StopEgressRequest
from livekit.api import LiveKitAPI

# Initialize the LiveKit API client
lkapi = LiveKitAPI(url="your-api-url", api_key="your-api-key", api_secret="your-api-secret")
egress_service = lkapi.egress

# Stop an egress by providing the ID within a StopEgressRequest object
egress_info = await egress_service.stop_egress(StopEgressRequest(egress_id="EG_n3RAjjfogxhV"))
Just be sure that the
StopEgressRequest
object is properly created with the
egress_id
field included. If you run into any more questions or need a hand, feel free to reach out—I’m here to help! Sources: lib/livekit/egress_service_client.rb | packages/livekit-server-sdk/src/EgressClient.ts | livekit-protocol/livekit/protocol/egress.pyi | livekit/livekit_egress.pb.go | cmd/lk/egress.go
b
how to pass AWS S3 bucket credentials so that egress recording will be stored?
t
To help you pass AWS S3 bucket credentials for storing egress recordings in LiveKit, you’ll want to include the credentials right in the egress request configuration. Here’s a friendly example for a Room Composite Egress:
Copy code
{
  "room_name": "my-room",
  "layout": "speaker",
  "file": {
    "file_type": "MP4",
    "filepath": "livekit-demo/recording.mp4",
    "s3": {
      "access_key": "aws-access-key",
      "secret": "aws-access-secret",
      "region": "aws-region",
      "bucket": "my-bucket"
    }
  }
}
You can easily start this using the LiveKit CLI with the following command:
Copy code
lk egress start --type room-composite request.json
For your security, I recommend considering temporary credentials or IAM roles instead of using long-lived access keys directly. If you have any questions or need a hand with this, please don’t hesitate to reach out—I’m here to help! Sources: RoomComposite Egress | LiveKit Docs | Web Egress | LiveKit Docs | Track Composite Egress | LiveKit Docs | examples/egress.yaml | test/config-sample.yaml
b
this is the issue: Our Python Code: s3=api.S3Upload( bucket=s3_bucket, # ✅ "my-bucket" region=s3_region, # ✅ "aws-region" access_key=s3_access_key, # ✅ "aws-access-key" secret=s3_secret_key, # ✅ "aws-access-secret" force_path_style=True, ) 🔍 The Real Issue Since our configuration is correct, the problem appears to be that LiveKit Cloud is ignoring our explicit credentials and trying to use EC2 instance metadata instead. From the error: failed to refresh cached credentials, no EC2 IMDS role found This suggests LiveKit Cloud might: 1. Have a bug where it ignores static credentials 2. Be configured to prefer IAM roles over static credentials 3. Have some other authentication precedence issue 🛠️ Next Steps As you mentioned, IAM roles are more secure than long-lived access keys. Let's try that approach: 1. Create an IAM role that LiveKit can assume 2. Use assume_role_arn in the S3Upload config instead of static credentials 3. Test with the new authentication method Would you like me to set up the IAM role-based authentication instead of the static credentials?
t
Thank you for reaching out! I understand this can be a bit confusing. The knowledge base doesn’t clearly state whether LiveKit Cloud prefers IAM roles over static credentials or if there might be a bug causing this behavior. To help you better, could you please let me know if you’re running this on an EC2 instance or another environment? Also, if possible, could you try testing with IAM role-based authentication to see if that helps resolve the issue? I’m here to support you every step of the way!
b
i use Lambda & AWS RDS & S3
t
Thanks so much for sharing that you’re using Lambda, AWS RDS, and S3. It sounds like the error might be because LiveKit Cloud is trying to use AWS instance metadata for credentials, which often happens in Lambda environments where IAM roles are usually preferred over static credentials. To help you get this sorted, here’s a friendly step-by-step on how to set up IAM role-based authentication: 1. Create an IAM role that has the right permissions to access your S3 bucket. 2. Attach that IAM role to your Lambda function. 3. Then, update your
S3Upload
configuration to use
assume_role_arn
instead of static credentials, like this:
Copy code
s3 = api.S3Upload(
    bucket="my-bucket",
    region="aws-region",
    assume_role_arn="arn:aws:iam::123456789012:role/YourRoleName",
    force_path_style=True,
)
This way, you’re using temporary credentials from the IAM role, which is not only more secure but should also fix the issue with LiveKit Cloud defaulting to instance metadata. Please feel free to reach out if you want a hand setting this up or testing your configuration—I’m here to help!
b
error: {"message": "📁 S3 destination: s3:///call__+918903871893_hRoTHhyYSgP8_20250928_194630.mp4", "level": "INFO", "name": "agent.recording", "pid": 78, "job_id": "AJ_TVRTGtzcQSFg", "timestamp": "2025-09-28T194630.240532+00:00"} {"message": "🔐 S3Upload config created - bucket: , region: us-east-1", "level": "INFO", "name": "agent.recording", "pid": 78, "job_id": "AJ_TVRTGtzcQSFg", "timestamp": "2025-09-28T194630.240555+00:00"} {"message": "🔐 S3Upload using IAM role: arnawsiam:707177721418role/LiveKitS3EgressRole", "level": "INFO", "name": "agent.recording", "pid": 78, "job_id": "AJ_TVRTGtzcQSFg", "timestamp": "2025-09-28T194630.240572+00:00"} {"message": "🔐 S3Upload has assume_role_arn: True", "level": "INFO", "name": "agent.recording", "pid": 78, "job_id": "AJ_TVRTGtzcQSFg", "timestamp": "2025-09-28T194630.240588+00:00"} {"message": "✅ LiveKit API client created for egress", "level": "INFO", "name": "agent.recording", "pid": 78, "job_id": "AJ_TVRTGtzcQSFg", "timestamp": "2025-09-28T194630.240746+00:00"} {"message": "❌ Error starting recording for room call__+918903871893_hRoTHhyYSgP8: TwirpError(code=permission_denied, message=S3 upload using AssumeRole is disabled for this account, status=403)", "level": "ERROR", "name": "agent.recording", "pid": 78, "job_id": "AJ_TVRTGtzcQSFg", "timestamp": "2025-09-28T194630.306744+00:00"} {"message": "⚠️ Failed to start recording for room call__+918903871893_hRoTHhyYSgP8", "level": "WARNING", "name": "agent.orchestrator", "pid": 78, "job_id": "AJ_TVRTGtzcQSFg", "timestamp": "2025-09-28T194630.306855+00:00"}
t
It looks like you're encountering the error "TwirpError(code=permission_denied, message=S3 upload using AssumeRole is disabled for this account)." This usually means that the S3 AssumeRole feature isn’t currently enabled for your LiveKit Cloud account. To allow egress recordings to use IAM roles for S3 uploads, this feature needs to be turned on by LiveKit specifically for your account. Here’s how we can get this sorted out: 1. Reach out to your LiveKit account administrator or contact LiveKit support to kindly request enabling the S3 AssumeRole feature for your account. 2. After it’s enabled, please double-check that your S3 upload configuration looks like this:
Copy code
s3 = api.S3Upload(
    bucket="my-bucket",
    region="aws-region",
    assume_role_arn="arn:aws:iam::123456789012:role/YourRoleName",
    force_path_style=True,
)
If you have any questions or need a hand with any step along the way, just let me know—I’m here to help! Sources: livekit-protocol/src/livekit.rs | protobufs/livekit_egress.proto | pkg/config/storage.go
b
can i do it in webconsole?
t
Hi there! I wanted to let you know that enabling the S3 AssumeRole feature for your LiveKit Cloud account isn’t something you can do directly through the web console. It actually needs a little help from our LiveKit support team or your account administrator to get it set up for you. If you could reach out to LiveKit support or your account administrator to ask for this feature to be enabled, that would be great. Once it’s activated, you’ll be all set to configure your S3 upload settings using the IAM role. And please don’t hesitate to reach out if you have any questions or need a hand with any part of this—I’m here to help!
b
am an admin.. how i can enable this?
t
I don't have the answer you're looking for. You could also try asking your question: • in one of the other Slack channels or • to https://deepwiki.com/livekit/livekit_composite which is trained on all LiveKit source code If you find the answer, please post it here to help others!
b
Can we do this Prewarm function to keep agent ready and prevent cold starts