add thread id property
This commit is contained in:
20
src/index.py
20
src/index.py
@@ -8,13 +8,13 @@ from typing import Optional
|
||||
|
||||
class CodexAgentConfig(PrecompiledConfig):
|
||||
signature: str | type[Signature] = "message:str -> answer:str"
|
||||
working_directory: str = ""
|
||||
model: Optional[str] = None
|
||||
working_directory: str = "."
|
||||
model: Optional[str] = "gpt-4o"
|
||||
sandbox_mode: Optional[SandboxMode] = None
|
||||
skip_git_repo_check: bool = False
|
||||
api_key: Optional[str] = None
|
||||
base_url: Optional[str] = None
|
||||
codex_path_override: Optional[str] = None
|
||||
codex_path_override: Optional[str] = "/opt/homebrew/bin/codex"
|
||||
|
||||
class CodexAgent(PrecompiledAgent):
|
||||
config : CodexAgentConfig
|
||||
@@ -34,4 +34,16 @@ class CodexAgent(PrecompiledAgent):
|
||||
)
|
||||
|
||||
def forward(self, **kwargs) -> Prediction:
|
||||
return self.codex_module(**kwargs)
|
||||
return self.codex_module(**kwargs)
|
||||
|
||||
@property
|
||||
def thread_id(self) -> Optional[str]:
|
||||
"""Get thread ID for this agent instance.
|
||||
|
||||
The thread ID is assigned after the first forward() call.
|
||||
Useful for debugging and visibility into the conversation state.
|
||||
|
||||
Returns:
|
||||
Thread ID string, or None if no forward() calls have been made yet
|
||||
"""
|
||||
return self.codex_module.thread.id
|
||||
Reference in New Issue
Block a user