microsoft / microsoft/agent-framework
NET: [Feature]: dotnet packages has not implemented some features of Python packages
@SergeyMenshykh is already working on this.
Since Apr 29, 2026.
- Dominant language
- Python
- Stars
- 13.6k
- Forks
- 2.3k
- Avg merge
- 2d 45m
- Merged PRs (30d)
- 358
Description
### Description
dotnet packages has not implemented some features of Python packages.
Because of the differences, I cannot quickly port Python code to C#.
### Code Sample
```markdown
session = agent.create_session()
print(session.session_id)
//c#
var currentSession = await agent.CreateSessionAsync(); // not found currentSession.SessionId???
FunctionInvocationContext
@tool(approval_mode="never_require",
description='read file')
def read_file(
ctx: FunctionInvocationContext,
file_path: str,
encoding: Optional[str] = None,
create_if_missing: bool = False
) -> Tuple[str, bool]:
print(ctx.session.session_id)
//c#
[Description("write file")]
public static (bool Success, string Message) WriteFile(
[Description("文件路径")] string file_path,
[Description("内容")] string content,
[Description("编码")] string? encoding = null,
[Description("允许覆盖")] bool overwrite = true,
FunctionInvocationContext? context = null)
{
//not found context.Session???
}
python:
`class SandboxMiddleware(AgentMiddleware):`
C# does not implement class-based middleware writing.
```
```
async with Agent(
client=client,
name="TaskMaster",
instructions="""你是专业助手**:
""",
tools=[read_file, write_file, list_directory, create_directory],
middleware=[
SandboxMiddleware(base_sandbox_dir=BASE_SANDBOX_DIR)
],
context_providers=[skills_provider],
default_options={"think": True}
) as agent:
```
```
var agent = ollamaClient.AsAIAgent(new ChatClientAgentOptions()
{
Name = "TaskMaster",
ChatOptions = new()
{
Instructions = """
你是专业助手
""",
Tools = tools,
Reasoning = new() { Effort = ReasoningEffort.High }
}
}
);
//not found agent.MiddleWare ???
```
### Language/SDK
.NET
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.